#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
@Author  : Liu Yue
@Time    : 2018/12/5 18:34
@describe: 登录
"""
import allure

from android.module.base import Base
from config import user_name, id_card
from tools.loggers import JFMlogging

logger = JFMlogging().getloger()

username_edit = "com.julanling.dgq:id/edName"
id_edit = "com.julanling.dgq:id/idCardView"
select_edit = "com.julanling.dgq:id/cb"
login_btn = "登录"
username_text = "账号"
id_text = "身份证"
select_text = "勾选同意协议"
my = "我的"


class Login(Base):

    def __init__(self, driver):
        self.base = Base(driver)

    @allure.story('登录')
    def login(self):
        self.base.send_keys(username_edit, user_name, username_text)
        self.base.send_keys(id_edit, id_card, id_text)
        self.base.click(select_edit, select_text)
        self.base.click(login_btn, login_btn)
        self.base.assert_exited(my)
